package cool.tianyou.blue.bird.activity;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;

import com.alibaba.fastjson.JSONObject;

import cool.tianyou.blue.bird.constant.Constant;
import cool.tianyou.blue.bird.R;
import cool.tianyou.blue.bird.util.HttpUtil;
import cool.tianyou.blue.bird.util.SpUtil;
import cool.tianyou.blue.bird.util.Util;

import com.xuexiang.xui.XUI;

public class LoginConfirmActivity extends AppCompatActivity {
    private String uuid;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        XUI.initTheme(this);
        setContentView(R.layout.activity_login_confirm);
        Intent intent = getIntent();
        this.uuid = intent.getStringExtra("uuid");
        Constant.USER_INFO.TOKEN = SpUtil.getString(this, Constant.SP_CONSTANT.TOKEN, "");
        Constant.USER_INFO.USER_ID = SpUtil.getString(this, Constant.SP_CONSTANT.USER_ID, "");
    }

    @RequiresApi(api = Build.VERSION_CODES.N)
    public void confirmLogin(View v) {
        HttpUtil.get(this, null, "/account/confirm/" + uuid, result -> {
            if (result.getCode() == 200) {
                finish();
            }
        });
    }

    public void cancelLogin(View v) {
        finish();
    }
}